package com.cg.controller;

import com.cg.dto.Result;
import com.cg.dto.ResultUtils;
import com.cg.service.DoctorService;
import com.cg.vo.DoctorListVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Doctor)表控制层
 *
 * @author chengong
 * @since 2024-01-08 17:53:55
 */
@RestController
@RequestMapping("/doctor")
public class DoctorController {
    /**
     * 服务对象
     */
    @Resource
    private DoctorService doctorService;


    /**
     * 根据医生姓名模糊查询医生列表
     */
    @GetMapping("/queryDoctorList")
    public Result<List<DoctorListVo>> queryDoctorList(@RequestParam("doctorName") String doctorName){
        List<DoctorListVo> doctorListVoList = doctorService.queryDoctorList(doctorName);
        return ResultUtils.returnDataSuccess(doctorListVoList);
    }


    /**
     * 根据医生id查询医生详情
     */
    @GetMapping("/queryDoctorByDoctorId")
    public Result<DoctorListVo> queryDoctorByDoctorId(@RequestParam("doctorId") Integer doctorId){
        DoctorListVo doctorListVo = doctorService.queryDoctorByDoctorId(doctorId);
        return ResultUtils.returnDataSuccess(doctorListVo);
    }
}

